script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;
	if(num==1)
	{
		imgEnemy=csd~"..\lib\fairy_red.png";
	}
	if(num==2)
	{
		imgEnemy=csd~"..\lib\fairy_blue.png";
	}
	let imgCircle=csd~"..\img\circle.png";
	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(400);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	SetCollisionA(GetX(),GetY(),48);
	yield;
    }

        @DrawLoop {
		SetColor(ZakoColor[0],ZakoColor[1],ZakoColor[2]);
		DrawFairy(imgEnemy);
		DrawMagicCircle("BLUE",0.50);
	}

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,2,0.5);
		FinalizeItemAndShotnumWithDelete(5);
        } 

task Tmain
{
yield;
Stage3FairyCommonTask;
summon;
OutDamageRateZero;
AutoErazeTime(1200);
GetDamege;
//MagicColor;
move;

alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

}


task move
{
//	SetMovePosition02(GetCenterX,GetCenterY-64,480);
//	wait(241);
	SetSpeed(GetSpeed);
	SetAngle(90);
}

task shotM
{
wait(60);
let dir=rand_int(0,1)*2-1;
loop
{
let angle=90+rand(-3,3);
	loop(8)
	{

	ascent(i in 1..5)
	{
	CreateShot01(GetX,GetY,5,angle+i*6.5,9,5);
	}
	ascent(i in 1..5)
	{
	CreateShot01(GetX,GetY,5,angle-i*6.5,9,5);
	}
	wait(3);
	angle+=0.5*dir;
	}
dir=dir*-1;
wait(30);
}
}
/////////////////////////////////////////////////////
task shotE
{
wait(60);
loop
{
let angle=GetAngleToPlayer;
	ascent(i in -3..3)
	{
		if(GetPlayerY>GetY+15)
		{
		CreateShot01(GetX,GetY,3,angle+i*6.0,9,5);
		}
	}
wait(30);
}
}
/////////////////////////////////////////////////////////
task shotA
{
wait(60);
loop
{
let angle=GetAngleToPlayer;
	ascent(i in -4..4)
	{
		if(GetPlayerY>GetY+15)
		{
		CreateShot01(GetX,GetY,3.0,angle+i*5.0,9,5);
		}
	}
wait(20);
}
}

task summon
{
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, 1);
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, -1);
}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\txt/Stage3FairyCommondata.txt"
#include_function ".\..\lib\lib_anime_fairy.txt"
}


script_enemy Familiar {
    let csd     = GetCurrentScriptDirectory;
    let imgFam  = csd ~ "..\img\familiar.png";
	let num = GetArgument;
    @Initialize {
	SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(10000);
        SetScore(10000);
        SetDamageRateEx(100,100,0,0);
        SetTexture(imgFam);
        setGraphic;
	TMain;
    }

    @MainLoop {
	SetCollisionA(GetX,GetY,48);
        yield;
    }

    @DrawLoop {
       // DrawGraphic(GetX, GetY);
    }
        @Finalize
        {
		FinalizeItemAndShotnum(1);
        } 
    task TMain {
        yield;
	ZakoEffect(255,0,0);
	GetDamege;
	move;
alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}
	ElementalAutoErazeTime(1190);
    }

task move
{
	loop
	{
		SetX(num*80);
		SetY(-10);
		yield;
	}
}

task shotM
{
let r=20;
wait(30);
	loop
	{
	shot1;
	wait(15);
	}

	task shot1
	{
		ascent(i in -1..2)
		{
		CreateShot01(GetX,GetY,4,GetAngle+90+i*45,9,0);
		}
	}
}
///////////////////////////////////////////////////////////////
task shotE
{
let r=20;
wait(30);
SubShot;
	loop
	{
	shot1;
	wait(10);
	}

	task shot1
	{
		ascent(i in -1..2)
		{
		CreateShot01(GetX,GetY,4,GetAngle+90+i*45,9,0);
		}
	}

	task SubShot
	{
	loop
	{
		let angle=+rand(-5,5);
		ascent(i in -6..7)
		{
		CreateShot01(GetX,GetY,2,GetAngle+90+i*10+angle,9,0);
		CreateShot01(GetX,GetY,2.5,GetAngle+90+i*10+angle,9,0);
		}
	wait(60);
	}
	}
}
//////////////////////////////////////////////////////////////
task shotA
{
let r=20;
wait(30);
SubShot;
	loop
	{
	shot1;
	wait(10);
	}

	task shot1
	{
		ascent(i in -1..2)
		{
		CreateShot01(GetX,GetY,4,GetAngle+90+i*45,9,0);
		}
	}

	task SubShot
	{
	loop
	{
		let angle=+rand(-5,5);
		ascent(i in -6..7)
		{
		CreateShot01(GetX,GetY,2,GetAngle+90+i*10+angle,9,0);
		}
	wait(15);
	}
	}
}


    // OtBbN̐ݒ
sub setGraphic{ SetGraphicRect( 0, 48, 48, 96); }
#include_function ".\..\txt/StageEnemydata.txt"
}


#include_script ".\..\txt/EnemyShotData.txt"